package com.esdk.sql;

import com.esdk.sql.orm.AbstractSelect;

public class ExistsCondition extends Condition{
  private ISelect select;
  private String expression;

  public ExistsCondition(ISelect select){
    this(false,select);
  }

  public ExistsCondition(boolean isNotExists,ISelect select){
  	this.select=select;
  	expression=isNotExists?Where.NOT_EXISTS:Where.EXISTS;
  }

  public String toString() {
    return new StringBuilder(expression).append(' ').append('(').append(select.getSQL()).append(')').toString();
  }
  
}